package com.longyiqun.cm.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.longyiqun.cm.domain.TestCaseEntity;
import com.longyiqun.cm.domain.fileEntity;
import com.longyiqun.cm.mapper.CasesMapper;
import com.longyiqun.cm.mapper.FileMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class FileServiceImpl implements FileService {
    @Autowired
    private FileMapper fileMapper;

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    public FileServiceImpl(FileMapper fileMapper) {
        this.fileMapper = fileMapper;
    }

    @Override
    public PageInfo getFileForPaging(int pageIndex, int pageNum) {

        PageHelper.startPage(pageIndex, pageNum);
        List<fileEntity> list  = fileMapper.findAllfile();
        logger.error("Get file: " + list.size());
        PageInfo page = new PageInfo(list);
        return page;
    }
}
